package com.leju.common.view.adapter;

import java.util.List;

import android.content.Context;
import android.graphics.Typeface;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * WheelView文本适配器
 * 
 * @author 梁瑞宇(ruiyu1@leju.sina.com.cn)
 * 
 */
public class WheelTextArrayAdapter extends ArrayWheelAdapter<String> {
	private Context context;

	/**
	 * Constructor
	 */
	public WheelTextArrayAdapter(Context context, List<String> items,int size) {
		super(context, items);
		this.context = context;
		if(size==-1)
			setTextSize(21);
		else
			setTextSize(size);
	}

	@Override
	protected void configureTextView(TextView view) {
		super.configureTextView(view);
		view.setHeight((int)(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40, context.getResources().getDisplayMetrics()) + 0.5));
		view.setTypeface(Typeface.MONOSPACE);
	}

	@Override
	public View getItem(int index, View cachedView, ViewGroup parent) {
		return super.getItem(index, cachedView, parent);
	}
}
